{% extends "profiles/base.html" %}
{% load snippets %}
{% block title %}{{profile.display_name}} - {{block.super}}{% endblock %}

{% block content %}
<h1>{{profile.display_name}} ({{profile.user.username}})</h1>

<dl>
{% if profile.website %}
<dt>website:</dt><dd><a href="{{profile.website}}">{{profile.website}}</a></dd>
{% endif %}
{% if profile.irc_nick %}
<dt>irc nick:</dt><dd><pre>{{profile.irc_nick}}</pre></dd>
{% endif %}
{% if profile.languages %}
<dt>languages:</dt><dd>{{profile.languages}}</dd>
{% endif %}
{% if show_timezone %}
<dt>timezone:</dt><dd>{{profile.get_time_zone_display}}</dd>
{% endif %}
{% if show_status %}
<dt>stautus:</dt><dd>{% if profile.user|is_online %}<span class="user_online">online</span>{% else %}<span class="user_offline">offline</span>{% endif %}</dd>
{% endif %}
{% if snippets %}
<dt>posted snippet{{snippets|pluralize}}:</dt>
<dd>
<ul>
    {% for snippet in snippets %}
    <li>{% show_snippet snippet 0 %}</li>
    {% endfor %}
</ul>
    <span id="snippet_feeds" class="feeds">
    Follow:
        <a class="feedlink" href="{% url rss_feeds "snippets" %}users/{{profile.user.username}}/" rel="alternate"  type="application/rss+xml">
           <img class="feedicon" src="{{MEDIA_URL}}images/rss_icon.png" alt="rss icon"/>
        </a>
        <a class="feedlink" href="{% url atom_feeds "snippets" %}users/{{profile.user.username}}/" rel="alternate"  type="application/atom+xml">
           <img class="feedicon" src="{{MEDIA_URL}}images/atom_icon.png" alt="atom icon"/>
        </a>
    </span>
</dd>
{% endif %}
{% if bookmarks %}
<dt>bookmarked snippet{{bookmarks|pluralize}}:</dt>
 <dd>
   <div id="user-bookmarks">
<ul>
{% for bookmark in bookmarks %}
  <li>
    <span class="snippet">
    <a href="{{ bookmark.snippet.get_absolute_url }}">{{ bookmark.snippet.title }}</a>
    (<a href="{{ bookmark.snippet.language.get_absolute_url }}">{{ bookmark.snippet.language.name }}</a>) by 
    {{ bookmark.snippet.author|userlink }}</span>
    (bookmarked {{ bookmark.date|timesince }} ago) 
    {% ifequal bookmark.user request.user %}
    <a href="{% url delete_bookmark bookmark.id %}">Delete this bookmark</a>
    {% endifequal %}
  </li>
{% endfor %}
</ul>
   </div>
 {% if not show_bookmarks %}
    <span>note: only you can see your bookmarks here</span>
 {% endif %}
 </dd>
{% endif %}

{% if profile.description %}
<dt>about:</dt><dd><div id="user-description">{{profile.raw_description|safe}}</div></dd>
{% endif %}
</dl>


<h2>{{profile.display_name}}'s Projects</h2>
{% if profile.get_projects %}
<table id="user_projects">
<tr><th>Admin of </th><th>Member of </th><tr>
{% for ap, mp in profile.get_projects %}
<tr>
<td>
  {% if ap %}
    {% tags_for_object ap as tag_list %}
    <a href="{{ap.get_absolute_url}}" class="small_thumb" title="{{ap.comment_count}} comment{{ap.comment_count|pluralize}}{% if tag_list %}; tag{{tag_list|pluralize}}: {{tag_list|join_nicer}}{% endif %}">
       {{ap.get_screenshot.preview}}</a>
    <a href="{{ap.get_absolute_url}}">{{ap.name}}</a>
  {% else %}
    {% if forloop.first %}
      {{profile.display_name}} it not admin of any project.
    {% endif %}
  {% endif %}
</td>
<td>
  {% if mp %}
    {% tags_for_object mp as tag_list %}
    <a href="{{mp.get_absolute_url}}" class="small_thumb" title="{{mp.comment_count}} comment{{mp.comment_count|pluralize}}{% if tag_list %}; tag{{tag_list|pluralize}}: {{tag_list|join_nicer}}{% endif %}">
       {{mp.get_screenshot.preview}}</a>
    <a href="{{mp.get_absolute_url}}">{{mp.name}}</a>
  {% else %}
    {% if forloop.first %}
      {{profile.display_name}} it not member of any project.
    {% endif %}
  {% endif %}
</td>
{% endfor %}
</table>
{% else %}
<p>{{profile.display_name}} is not yet admin or member of any project.</p>
{% endif %}




<h2>Contact</h2>
{% ifequal profile.contact "none" %}
You cannot contact this user.
{% else %}
  {% ifequal profile.contact "all" %}
      Write an <a href="mailto:{{profile.user.email}}">email</a> to {{profile.display_name}}
  {% else %}
      {% if user.is_authenticated %}
        {% ifequal profile.contact "users" %}
           Write an <a href="mailto:{{profile.user.email}}">email</a> to {{profile.display_name}}
        {% else %}
            {% if form %}
            <h3>Send an email to {{profile.display_name}}</h3>
            <form action="" method="post" class="styled">
            <table>
            {{form}}
            <tr><td></td><td><input type="submit" value="send" class="button" /></td></tr>
            </table>
            </form>
            {% endif %}
        {% endifequal %}
      {% else %}
        <a href="{% url auth_login %}">Log in</a> to contact this user
      {% endif %}
  {% endifequal %}      
{% endifequal %}

{% endblock %}
 
 
 
 
